import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBWeChatPopPage/YBWeChatPopPage.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBJsonToModel/YBMineModel/YBMineZuZhiNumberManagerModel.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBMineModule/YBMineProvider/YBMineZuZhiManagerProvider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBMineModule/YBQiYePersonPage/YBNumberManagerSubPage.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBUtils/YBBaseUtils/YBWeChatUtils.dart';


class YBNumberManangerMainPage extends StatelessWidget {

  final String orgcode;

  const YBNumberManangerMainPage({Key key, this.orgcode}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    print('------$orgcode--');
    return Container(
      child: Scaffold(
        appBar: AppBar(
          title: Text(
            YBChineseText.mineNumberManagerTitle,
            style: YBTextStyle.TextStyle30313320Medium
          ),
          elevation: 0,
        ),

        body: ChangeNotifierProvider(
          create: (context) =>YBMineZuZhiNumberManagerProvider()..getMineNumberManagerData(orgcode),
          child: Consumer<YBMineZuZhiNumberManagerProvider>(
              builder: (context,mineZuZhiManagerList,child){
                return CustomScrollView(
                  slivers: [
                    SliverFixedExtentList(
                        delegate: SliverChildBuilderDelegate((BuildContext context,int index){
                          YBMineZuZhiNumberManagerModel numberModel = mineZuZhiManagerList.numberManagerList[index];
                          return YBNumberManagerSubPage(nickName: numberModel.memberName,statusNumber: numberModel.memberType,telPhoneStr:numberModel.memberPhone,wechatStr: numberModel.memberWxNumber,emailStr: numberModel.memberEmail,departStr: numberModel.memberDepartment,zhiweiStr: numberModel.memberJobTitle,memberType: numberModel.memberType.toString(),memberCode: numberModel.memberCode,);
                        },childCount: mineZuZhiManagerList.numberManagerList.length), itemExtent: 48),
                    SliverToBoxAdapter(
                      child: Container(
                        height: YBTextStyle.adapterSize8,
                      ),
                    ),
                    SliverToBoxAdapter(
                      child: InkWell(
                        child: Container(
                          alignment: Alignment.center,
                          height: YBTextStyle.adapterSize48,
                          color: YBColor.white,
                          child: Text(
                            YBChineseText.mineYaoQingChengYuanTitle,
                            style: YBTextStyle.TextStyleA9AEB815,
                          ),
                        ),
                        onTap: (){
                          YBWeChatPopPage.showWeChatPopPage(context,urlStr:'http://app.laizone.com/share/invitation?orgCode=',title: "快来加入我们吧",description:"快来加入我们吧",thumbNailStr:"");
                        },
                      ),
                    ),
                  ],
                );
              }
          ),
        ),
      ),
    );
  }
}


